import financeApi from '@/api/declaration/erp/financeApi'
import httpRequest from '@/config/axios/httpRequest'
import { FinanceReceiptModel } from '@/models/erp/FinanceReceiptModel'



// ERP 收款单 API
export const FinanceReceiptApi = {
  // 查询收款单分页
  getFinanceReceiptPage: async (params: any) => {
    return await httpRequest.get(financeApi.GetFinanceReceiptPage, { params })
  },

  // 查询收款单详情
  getFinanceReceipt: async (id: number) => {
    return await httpRequest.get(financeApi.GetFinanceReceipt, { params: { id } })
  },

  // 新增收款单
  createFinanceReceipt: async (data: FinanceReceiptModel) => {
    return await httpRequest.post(financeApi.CreateFinanceReceipt, data)
  },

  // 修改收款单
  updateFinanceReceipt: async (data: FinanceReceiptModel) => {
    return await httpRequest.put(financeApi.UpdateFinanceReceipt, data)
  },

  // 更新收款单的状态
  updateFinanceReceiptStatus: async (id: number, status: number) => {
    return await httpRequest.put(financeApi.UpdateFinanceReceiptStatus, { id, status })
  },

  // 删除收款单
  deleteFinanceReceipt: async (ids: number[]) => {
    return await httpRequest.delete(financeApi.DeleteFinanceReceipt, { params: { ids: ids.join(',') } })
  },

  // 导出收款单 Excel
  exportFinanceReceipt: async (params: any) => {
    return await httpRequest.download(financeApi.ExportFinanceReceipt, params)
  }
}
